﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmbeddedSharp.Core;
using System.Windows.Forms;

namespace Zove.Scripting.Guikit {

    public class InputDialogNode : FuncNode {
        public InputDialogNode()
            : base() {
            base.Value = "InputDialog";
        }

        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new Exception("usage: InputDialog(message)");
            }

            string message = Parameters[0].Evaluate().ToString();
            InputDialog d = new InputDialog(message);
            if (d.ShowDialog() == DialogResult.OK) {
                return d.Input;
            }

            return string.Empty;
        }
    }
}
